from time import sleep
import uiautomation
import pyautogui
class zhuyuanyishengzhan():
        his = uiautomation.WindowControl(searchDepth=1, Name='科玛奇医院信息管理系统')  # 锁定窗口
        his.SetFocus()
        #患者列表
        huanzheliebiaozu = his.GroupControl(ClassName='GroupBox',Name='患者列表')
        suosubingren = huanzheliebiaozu.ComboBoxControl(AutomationId='comBox1',ClassName='ComboBox')
        zaiyuanfangshi = huanzheliebiaozu.ComboBoxControl(AutomationId='comBox2',ClassName='ComboBox')
        shurukuang = huanzheliebiaozu.EditControl(AutomationId='TbxInput',ClassName='TextBox').EditControl(AutomationId='Uc_TbxContent',ClassName='TextBox')
        chaxunanniu = huanzheliebiaozu.ButtonControl(AutomationId='BtnSearch',ClassName='Button')
        huanzhe1 = his.DataGridControl(AutomationId='dgHuanzheList',ClassName='YDataGrid').DataItemControl(ClassName='DataGridRow',Name='Ksy.ChssClient.Access.Model.ZY_BH0').CustomControl(ClassName='DataGridCell',SubName='列显示索引: 1')

        #操作区
        dianzibingli = his.ButtonControl(AutomationId='newemr_btn',ClassName='Button',Name='电子病历')
        sancedan = his.ButtonControl(AutomationId='btn_scd',ClassName='Button',Name='三测单')
        zhenduan = his.ButtonControl(AutomationId='zd_btn',ClassName='Button',Name='诊断')
        yizhumuban = his.ButtonControl(AutomationId='yzmb_btn',ClassName='Button',Name='医嘱模板')
        zhancun = his.ButtonControl(AutomationId='zc_btn',ClassName='Button',Name='暂存')
        tijiao = his.ButtonControl(AutomationId='confirm_btn',ClassName='Button',Name='提交')
        daying = his.ButtonControl(ClassName='Button',Name='打印')
        dayingjianchajianyandan = his.ButtonControl(ClassName='Button',Name='打印检查检验单')
        guominxinxi = his.ButtonControl(ClassName='Button',Name='过敏信息')
        zhuguanziliao = his.ButtonControl(ClassName='Button',Name='主观资料')
        feiyongbulu = his.ButtonControl(ClassName='Button',Name='费用补录')
        feiyongqingkuang = his.ButtonControl(ClassName='Button',Name='费用情况')
        huanzhexinxi = his.ButtonControl(ClassName='Button',Name='患者信息')
        shenqingdan = his.ButtonControl(ClassName='Button',Name='申请单')
        xiangmugaikuang = his.ButtonControl(ClassName='Button',Name='项目概况')
        shuaxing = his.ButtonControl(ClassName='Button',Name='刷新')
        weizhixing = his.RadioButtonControl(ClassName='RadioButton',Name='未执行')
        yizhixing = his.RadioButtonControl(ClassName='RadioButton',Name='已执行')
        yitingzhi = his.RadioButtonControl(ClassName='RadioButton',Name='已停止')
        quanbu = his.RadioButtonControl(ClassName='RadioButton',Name='全部')
        xianshiyizuofeiyizhu = his.CheckBoxControl(AutomationId='showDiacardedYZ',ClassName='CheckBox',Name='显示已作废医嘱')
#右键菜单
        #停止长期医嘱
        tingyizhu = his.MenuControl(ClassName='ContextMenu').MenuItemControl(ClassName='MenuItem',Name='停医嘱<T>')
        #增加长期医嘱项目组
        zhengjiaxiangmu1 = his.MenuControl(ClassName='ContextMenu').MenuItemControl(ClassName='MenuItem',Name='增加<A>')
        # 增加临时医嘱项目组
        zhengjiaxiangmu2 = his.MenuControl(ClassName='ContextMenu').MenuItemControl(ClassName='MenuItem', Name='增加<A>')



        # 温馨提示窗口
        wenxintishichuangkou = his.WindowControl(ClassName='Window',Name='温馨提示')
        wenxintishiqueding = wenxintishichuangkou.ButtonControl(AutomationId='OkBtn',ClassName='Button',Name='确定')

        #停医嘱提示窗口
        tingyizhutishichuangkou = his.WindowControl(Name='停医嘱')
        tingyizhutishichuangkouquedin=tingyizhutishichuangkou.ButtonControl(AutomationId='save_btn',ClassName='Button',Name='确定')


        #长期医嘱
        changqiyizhu = his.TabControl(AutomationId='tab_CqLs',ClassName='TabControl').TabItemControl(AutomationId='cqyz_ti',ClassName='TabItem',Name='长期医嘱')
        #长期医嘱内容
        cqyizhuneirong1 = his.CustomControl(ClassName='DataGridCell',SubName='列显示索引: 4',foundIndex=1)
        cqyizhuneirong1_1 = cqyizhuneirong1.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        cqyizhuneirong2 = his.CustomControl(ClassName='DataGridCell',SubName='列显示索引: 4',foundIndex=2)
        cqyizhuneirong2_1 = cqyizhuneirong2.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        cqyizhuneirong3 = his.CustomControl(ClassName='DataGridCell',SubName='列显示索引: 4',foundIndex=3)
        cqyizhuneirong3_1 = cqyizhuneirong3.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        cqyizhuneirong4 = his.CustomControl(ClassName='DataGridCell',SubName='列显示索引: 4',foundIndex=4)
        cqyizhuneirong4_1 = cqyizhuneirong4.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        cqyizhuneirong5 = his.CustomControl(ClassName='DataGridCell',SubName='列显示索引: 4',foundIndex=5)
        cqyizhuneirong5_1 = cqyizhuneirong5.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        #长期医嘱用法
        cqyongfa1 = his.DataGridControl(AutomationId='dgMedInput', ClassName='YDataGrid').CustomControl(ClassName='DataGridCell',SubName='列显示索引: 7',foundIndex=1)
        cqyongfa1_1 = cqyongfa1.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        cqyongfa2 = his.DataGridControl(AutomationId='dgMedInput', ClassName='YDataGrid').CustomControl(ClassName='DataGridCell',SubName='列显示索引: 7',foundIndex=2)
        cqyongfa2_1 = cqyongfa2.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        cqyongfa3 = his.DataGridControl(AutomationId='dgMedInput', ClassName='YDataGrid').CustomControl(ClassName='DataGridCell',SubName='列显示索引: 7',foundIndex=3)
        cqyongfa3_1 = cqyongfa3.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        cqyongfa4 = his.DataGridControl(AutomationId='dgMedInput', ClassName='YDataGrid').CustomControl(ClassName='DataGridCell',SubName='列显示索引: 7',foundIndex=4)
        cqyongfa4_1 = cqyongfa4.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        cqyongfa5 = his.DataGridControl(AutomationId='dgMedInput', ClassName='YDataGrid').CustomControl(ClassName='DataGridCell',SubName='列显示索引: 7',foundIndex=5)
        cqyongfa5_1 = cqyongfa5.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        #长期医嘱频次
        cqpingci1 = his.DataGridControl(AutomationId='dgMedInput', ClassName='YDataGrid').CustomControl(ClassName='DataGridCell', SubName='列显示索引: 8', foundIndex=1)
        cqpingci1_1 = cqpingci1.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        cqpingci2 = his.DataGridControl(AutomationId='dgMedInput', ClassName='YDataGrid').CustomControl(ClassName='DataGridCell', SubName='列显示索引: 8', foundIndex=2)
        cqpingci2_1 = cqpingci2.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        cqpingci3 = his.DataGridControl(AutomationId='dgMedInput', ClassName='YDataGrid').CustomControl(ClassName='DataGridCell', SubName='列显示索引: 8', foundIndex=3)
        cqpingci3_1 = cqpingci3.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        cqpingci4 = his.DataGridControl(AutomationId='dgMedInput', ClassName='YDataGrid').CustomControl(ClassName='DataGridCell', SubName='列显示索引: 8', foundIndex=4)
        cqpingci4_1 = cqpingci4.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        cqpingci5 = his.DataGridControl(AutomationId='dgMedInput', ClassName='YDataGrid').CustomControl(ClassName='DataGridCell', SubName='列显示索引: 8', foundIndex=5)
        cqpingci5_1 = cqpingci5.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')

        #输入长期医嘱内容1
        def input_cqyz1(self,yznr):
                self.cqyizhuneirong1.DoubleClick()
                self.cqyizhuneirong1_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')
        #输入长期医嘱内容2
        def input_cqyz2(self,yznr):
                self.cqyizhuneirong2.DoubleClick()
                self.cqyizhuneirong2_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')
        #输入长期医嘱内容3
        def input_cqyz3(self,yznr):
                self.cqyizhuneirong3.DoubleClick()
                self.cqyizhuneirong3_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')
        #输入长期医嘱内容4
        def input_cqyz4(self,yznr):
                self.cqyizhuneirong4.DoubleClick()
                self.cqyizhuneirong4_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')
        #输入长期医嘱内容5
        def input_cqyz5(self,yznr):
                self.cqyizhuneirong5.DoubleClick()
                self.cqyizhuneirong5_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')

        #输入长期医嘱用法1
        def input_cqyzyf1(self,yf):
                self.cqyongfa1.DoubleClick()
                self.cqyongfa1_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')
        #输入长期医嘱用法2
        def input_cqyzyf2(self,yf):
                self.cqyongfa2.DoubleClick()
                self.cqyongfa2_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')
        #输入长期医嘱用法3
        def input_cqyzyf3(self,yf):
                self.cqyongfa3.DoubleClick()
                self.cqyongfa3_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')
        #输入长期医嘱用法4
        def input_cqyzyf4(self,yf):
                self.cqyongfa4.DoubleClick()
                self.cqyongfa4_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')
        #输入长期医嘱用法5
        def input_cqyzyf5(self,yf):
                self.cqyongfa5.DoubleClick()
                self.cqyongfa5_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')

        # 输入长期医嘱频次1
        def input_cqyzpc1(self, pc):
                self.cqpingci1.DoubleClick()
                self.cqpingci1_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入长期医嘱频次2
        def input_cqyzpc2(self, pc):
                self.cqpingci2.DoubleClick()
                self.cqpingci2_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入长期医嘱频次3
        def input_cqyzpc3(self, pc):
                self.cqpingci3.DoubleClick()
                self.cqpingci3_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入长期医嘱频次4
        def input_cqyzpc4(self, pc):
                self.cqpingci4.DoubleClick()
                self.cqpingci4_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入长期医嘱频次5
        def input_cqyzpc5(self, pc):
                self.cqpingci5.DoubleClick()
                self.cqpingci5_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        #输入项目数据1
        def add_cqxm1(self,yznr,yf,pc):
                self.input_cqyz1(yznr)
                self.input_cqyzyf1(yf)
                self.input_cqyzpc1(pc)
        #输入项目数据2
        def add_cqxm2(self,yznr,yf,pc):
                self.input_cqyz2(yznr)
                self.input_cqyzyf2(yf)
                self.input_cqyzpc2(pc)
        #输入项目数据3
        def add_cqxm3(self,yznr,yf,pc):
                self.input_cqyz3(yznr)
                self.input_cqyzyf3(yf)
                self.input_cqyzpc3(pc)
        #输入项目数据4
        def add_cqxm4(self,yznr,yf,pc):
                self.input_cqyz4(yznr)
                self.input_cqyzyf4(yf)
                self.input_cqyzpc4(pc)
        #输入项目数据5
        def add_cqxm5(self,yznr,yf,pc):
                self.input_cqyz5(yznr)
                self.input_cqyzyf5(yf)
                self.input_cqyzpc5(pc)

        #零时医嘱
        lingshiyizhu =his.TabControl(AutomationId='tab_CqLs',ClassName='TabControl').TabItemControl(AutomationId='lsyz_ti',ClassName='TabItem',Name='临时医嘱')
        # 零时医嘱内容
        lsyizhuneirong1 = his.CustomControl(ClassName='DataGridCell', SubName='列显示索引: 4', foundIndex=1)
        lsyizhuneirong1_1 = lsyizhuneirong1.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        lsyizhuneirong2 = his.CustomControl(ClassName='DataGridCell', SubName='列显示索引: 4', foundIndex=2)
        lsyizhuneirong2_1 = lsyizhuneirong2.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        lsyizhuneirong3 = his.CustomControl(ClassName='DataGridCell', SubName='列显示索引: 4', foundIndex=3)
        lsyizhuneirong3_1 = lsyizhuneirong3.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        lsyizhuneirong4 = his.CustomControl(ClassName='DataGridCell', SubName='列显示索引: 4', foundIndex=4)
        lsyizhuneirong4_1 = lsyizhuneirong4.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        lsyizhuneirong5 = his.CustomControl(ClassName='DataGridCell', SubName='列显示索引: 4', foundIndex=5)
        lsyizhuneirong5_1 = lsyizhuneirong5.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        # 零时医嘱用法
        lsyongfa1 = his.DataGridControl(AutomationId='dgMedInputLS', ClassName='YDataGrid').CustomControl(
                ClassName='DataGridCell', SubName='列显示索引: 7', foundIndex=1)
        lsyongfa1_1 = lsyongfa1.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        lsyongfa2 = his.DataGridControl(AutomationId='dgMedInputLS', ClassName='YDataGrid').CustomControl(
                ClassName='DataGridCell', SubName='列显示索引: 7', foundIndex=2)
        lsyongfa2_1 = lsyongfa2.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        lsyongfa3 = his.DataGridControl(AutomationId='dgMedInputLS', ClassName='YDataGrid').CustomControl(
                ClassName='DataGridCell', SubName='列显示索引: 7', foundIndex=3)
        lsyongfa3_1 = lsyongfa3.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        lsyongfa4 = his.DataGridControl(AutomationId='dgMedInputLS', ClassName='YDataGrid').CustomControl(
                ClassName='DataGridCell', SubName='列显示索引: 7', foundIndex=4)
        lsyongfa4_1 = lsyongfa4.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        lsyongfa5 = his.DataGridControl(AutomationId='dgMedInputLS', ClassName='YDataGrid').CustomControl(
                ClassName='DataGridCell', SubName='列显示索引: 7', foundIndex=5)
        lsyongfa5_1 = lsyongfa5.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')

        # # 零时医嘱频次
        lspingci1 = his.CustomControl(ClassName='DataGridCell', SubName='列显示索引: 9', foundIndex=1)
        lspingci1_1 = lspingci1.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        lspingci2 = his.CustomControl(ClassName='DataGridCell', SubName='列显示索引: 9', foundIndex=2)
        lspingci2_1 = lspingci2.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        lspingci3 = his.CustomControl(ClassName='DataGridCell', SubName='列显示索引: 9', foundIndex=3)
        lspingci3_1 = lspingci3.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        lspingci4 = his.CustomControl(ClassName='DataGridCell', SubName='列显示索引: 9', foundIndex=4)
        lspingci4_1 = lspingci4.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')
        lspingci5 = his.CustomControl(ClassName='DataGridCell', SubName='列显示索引: 9', foundIndex=5)
        lspingci5_1 = lspingci5.EditControl(AutomationId='PART_TextBox', ClassName='TextBox')

        # 输入零时医嘱内容1
        def input_lsyz1(self, yznr):
                self.lsyizhuneirong1.DoubleClick()
                self.lsyizhuneirong1_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱内容2
        def input_lsyz2(self, yznr):
                self.lsyizhuneirong2.DoubleClick()
                self.lsyizhuneirong2_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱内容3
        def input_lsyz3(self, yznr):
                self.lsyizhuneirong3.DoubleClick()
                self.lsyizhuneirong3_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱内容4
        def input_lsyz4(self, yznr):
                self.lsyizhuneirong4.DoubleClick()
                self.lsyizhuneirong4_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱内容5
        def input_lsyz5(self, yznr):
                self.lsyizhuneirong5.DoubleClick()
                self.lsyizhuneirong5_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱用法1
        def input_lsyzyf1(self, yf):
                self.lsyongfa1.DoubleClick()
                self.lsyongfa1_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱用法2
        def input_lsyzyf2(self, yf):
                self.lsyongfa2.DoubleClick()
                self.lsyongfa2_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱用法3
        def input_lsyzyf3(self, yf):
                self.lsyongfa3.DoubleClick()
                self.lsyongfa3_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱用法4
        def input_lsyzyf4(self, yf):
                self.lsyongfa4.DoubleClick()
                self.lsyongfa4_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱用法5
        def input_lsyzyf5(self, yf):
                self.lsyongfa5.DoubleClick()
                self.lsyongfa5_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱频次1
        def input_lsyzpc1(self, pc):
                self.lspingci1.DoubleClick()
                pyautogui.hotkey('ctrl', 'a')
                pyautogui.press('back')
                self.lspingci1_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱频次2
        def input_lsyzpc2(self, pc):
                self.lspingci2.DoubleClick()
                pyautogui.hotkey('ctrl', 'a')
                pyautogui.press('back')
                self.lspingci2_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱频次3
        def input_lsyzpc3(self, pc):
                self.lspingci3.DoubleClick()
                pyautogui.hotkey('ctrl', 'a')
                pyautogui.press('back')
                self.lspingci3_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱频次4
        def input_lsyzpc4(self, pc):
                self.lspingci4.DoubleClick()
                pyautogui.hotkey('ctrl', 'a')
                pyautogui.press('back')
                self.lspingci4_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入零时医嘱频次5
        def input_lsyzpc5(self, pc):
                self.lspingci5.DoubleClick()
                pyautogui.hotkey('ctrl', 'a')
                pyautogui.press('back')
                self.lspingci5_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入项目数据1
        def add_lsxm1(self, yznr, yf, pc):
                self.lsyizhuneirong1.DoubleClick()
                self.lsyizhuneirong1_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')
                self.lsyongfa1.DoubleClick()
                self.lsyongfa1_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')
                self.lspingci1.DoubleClick()
                pyautogui.hotkey('ctrl', 'a')
                pyautogui.press('back')
                self.lspingci1_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入项目数据2
        def add_lsxm2(self, yznr, yf, pc):
                self.lsyizhuneirong2.DoubleClick()
                self.lsyizhuneirong2_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')
                self.lsyongfa2.DoubleClick()
                self.lsyongfa2_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')
                self.lspingci2.DoubleClick()
                pyautogui.hotkey('ctrl', 'a')
                pyautogui.press('back')
                self.lspingci2_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入项目数据3
        def add_lsxm3(self, yznr, yf, pc):
                self.lsyizhuneirong3.DoubleClick()
                self.lsyizhuneirong3_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')
                self.lsyongfa3.DoubleClick()
                self.lsyongfa3_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')
                self.lspingci3.DoubleClick()
                pyautogui.hotkey('ctrl', 'a')
                pyautogui.press('back')
                self.lspingci3_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入项目数据4
        def add_lsxm4(self, yznr, yf, pc):
                self.lsyizhuneirong4.DoubleClick()
                self.lsyizhuneirong4_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')
                self.lsyongfa4.DoubleClick()
                self.lsyongfa4_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')
                self.lspingci4.DoubleClick()
                pyautogui.hotkey('ctrl', 'a')
                pyautogui.press('back')
                self.lspingci4_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        # 输入项目数据5
        def add_lsxm5(self, yznr, yf, pc):
                self.lsyizhuneirong5.DoubleClick()
                self.lsyizhuneirong5_1.SendKeys(yznr)
                sleep(1)
                pyautogui.press('enter')
                self.lsyongfa5.DoubleClick()
                self.lsyongfa5_1.SendKeys(yf)
                sleep(1)
                pyautogui.press('enter')
                self.lspingci5.DoubleClick()
                pyautogui.hotkey('ctrl', 'a')
                pyautogui.press('back')
                self.lspingci5_1.SendKeys(pc)
                sleep(1)
                pyautogui.press('enter')

        #中药医嘱
        zhongyaoyizhu =his.TabControl(AutomationId='tab_CqLs',ClassName='TabControl').TabItemControl(ClassName='TabItem',Name='中药医嘱')
        #带药出院
        chuyuandaiyao =his.TabControl(AutomationId='tab_CqLs',ClassName='TabControl').TabItemControl(AutomationId='TabItem_cydyModule',ClassName='TabItem',Name='出院带药')
        #申请报告单
        shenqingdanbaogao =his.TabControl(AutomationId='tab_CqLs',ClassName='TabControl').TabItemControl(AutomationId='TabItem_lisModule',ClassName='TabItem',Name='申请报告单')

        #添加长期医嘱项目
        def add_cqyz(self,num:int):

                for i in range(num):
                        uiautomation.RightClick(1210,515)
                        self.zhengjiaxiangmu1.Click()
        #停止长期医嘱
        def stop_cqyz(self):
                self.click_cqyz()
                self.cqyizhuneirong1.Click()
                pyautogui.hotkey('Ctrl','a')
                uiautomation.RightClick(1210, 515)
                self.tingyizhu.Click()
        #点击停医嘱提示确定按钮
        def click_stopyzqd(self):
                self.tingyizhutishichuangkouquedin.Click()
        #添加零时医嘱项目
        def add_lsyz(self,num:int):

                for i in range(num):
                        uiautomation.RightClick(1210,515)
                        self.zhengjiaxiangmu2.Click()

        #点击长期医嘱
        def click_cqyz(self):
                self.changqiyizhu.Click()
        #点击零时医嘱
        def click_lsyz(self):
                self.lingshiyizhu.Click()
        #点击中药医嘱
        def click_zyyz(self):
                self.zhongyaoyizhu.Click()
        #点击出院带药
        def click_cydy(self):
                self.chuyuandaiyao.Click()
        #点击申请报告单
        def click_sqdbg(self):
                self.shenqingdanbaogao.Click()

        #选择所属病人
        def click_ssbr(self,gg):
                self.suosubingren.Click()
                self.suosubingren.SendKeys(gg)
                pyautogui.press('enter')
        #选择在院状态
        def click_zyzt(self,mm):
                self.zaiyuanfangshi.Click()
                self.zaiyuanfangshi.SendKeys(mm)
                pyautogui.press('enter')
        #输入患者姓名
        def input_hzxm(self,name):
                self.shurukuang.Click()
                pyautogui.hotkey('ctrl', 'a')
                pyautogui.press('back')
                sleep(1)
                self.shurukuang.SendKeys(name)
        #点击查询按钮
        def click_cx_btn(self):
                # uiautomation.Click(480,160)
                self.shurukuang.Click()
                pyautogui.press('tab')
                pyautogui.press('enter')
                # self.chaxunanniu.Click()
        #点击患者1
        def click_hz1(self):
                self.huanzhe1.DoubleClick()
        #点击电子病历
        def click_dzbl_btn(self):
                self.dianzibingli.Click()
        #点击三测单
        def click_scd_btn(self):
                self.sancedan.Click()
        # 点击诊断
        def click_zd_btn(self):
                self.zhenduan.Click()
        # 点击医嘱模板
        def click_yzmb_btn(self):
                self.yizhumuban.Click()
        #点击暂存
        def click_zc_btn(self):
                self.zhancun.Click()
        #点击提交
        def click_tj_btn(self):
                self.tijiao.Click()
        #点击打印
        def click_dy_btn(self):
                self.daying.Click()
        #点击打印检查检验单
        def click_dyjcjyd_btn(self):
                self.dayingjianchajianyandan.Click()
        #点击过敏信息
        def click_gmxx_btn(self):
                self.guominxinxi.Click()
        #点击主观治疗
        def click_zgzl_btn(self):
                self.zhuguanziliao.Click()
        #点击费用补录
        def click_fybl_btn(self):
                self.feiyongbulu.Click()
        #点击费用情况
        def click_fyqk_btn(self):
                self.feiyongqingkuang.Click()
        #点击患者信息
        def click_hzxx_btn(self):
                self.huanzhexinxi.Click()
        # 点击申请单
        def click_sqd_btn(self):
                self.shenqingdan.Click()
        #点击项目概况
        def click_xmgk_btn(self):
                self.xiangmugaikuang.Click()
        # 点击刷新
        def click_sx_btn(self):
                self.shuaxing.Click()

        # 点击未执行
        def click_wzx_btn(self):
                self.weizhixing.Click()

        # 点击已执行
        def click_yzx_btn(self):
                self.yizhixing.Click()

        # 点击已停止
        def click_ytz_btn(self):
                self.yitingzhi.Click()

        # 点击全部
        def click_qb_btn(self):
                self.quanbu.Click()

        # 点击显示已作废医嘱
        def click_xsyzfyz_btn(self):
                self.xianshiyizuofeiyizhu.Click()
        #点击温馨提示确定按钮
        def clicl_wxtsqd_btn(self):
                self.wenxintishiqueding.Click()

        #提示重找
        def Rfind_tsqd(self):
                self.wenxintishichuangkou.Refind()
                self.wenxintishiqueding.Refind()








